\(\int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx\) [26]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 85 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=-4 i a^3 x-\frac {4 a^3 \log (\cos (c+d x))}{d}+\frac {2 i a^3 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d} \]

[Out]

-4*I*a^3*x-4*a^3*ln(cos(d*x+c))/d+2*I*a^3*tan(d*x+c)/d+1/2*a*(a+I*a*tan(d*x+c))^2/d+1/3*(a+I*a*tan(d*x+c))^3/d

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {3608, 3559, 3558, 3556} \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=\frac {2 i a^3 \tan (c+d x)}{d}-\frac {4 a^3 \log (\cos (c+d x))}{d}-4 i a^3 x+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d} \]

[In]

Int[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^3,x]

[Out]

(-4*I)*a^3*x - (4*a^3*Log[Cos[c + d*x]])/d + ((2*I)*a^3*Tan[c + d*x])/d + (a*(a + I*a*Tan[c + d*x])^2)/(2*d) +
 (a + I*a*Tan[c + d*x])^3/(3*d)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3558

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2)*x, x] + (Dist[2*a*b, Int[Tan[c + d
*x], x], x] + Simp[b^2*(Tan[c + d*x]/d), x]) /; FreeQ[{a, b, c, d}, x]

Rule 3559

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((a + b*Tan[c + d*x])^(n - 1)/(d*(n - 1))
), x] + Dist[2*a, Int[(a + b*Tan[c + d*x])^(n - 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && G
tQ[n, 1]

Rule 3608

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(
(a + b*Tan[e + f*x])^m/(f*m)), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a+i a \tan (c+d x))^3}{3 d}-i \int (a+i a \tan (c+d x))^3 \, dx \\ & = \frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d}-(2 i a) \int (a+i a \tan (c+d x))^2 \, dx \\ & = -4 i a^3 x+\frac {2 i a^3 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d}+\left (4 a^3\right ) \int \tan (c+d x) \, dx \\ & = -4 i a^3 x-\frac {4 a^3 \log (\cos (c+d x))}{d}+\frac {2 i a^3 \tan (c+d x)}{d}+\frac {a (a+i a \tan (c+d x))^2}{2 d}+\frac {(a+i a \tan (c+d x))^3}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.36 (sec) , antiderivative size = 57, normalized size of antiderivative = 0.67 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=\frac {a^3 \left (2+24 \log (i+\tan (c+d x))+24 i \tan (c+d x)-9 \tan ^2(c+d x)-2 i \tan ^3(c+d x)\right )}{6 d} \]

[In]

Integrate[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^3,x]

[Out]

(a^3*(2 + 24*Log[I + Tan[c + d*x]] + (24*I)*Tan[c + d*x] - 9*Tan[c + d*x]^2 - (2*I)*Tan[c + d*x]^3))/(6*d)

Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.73

method result size
derivativedivides \(\frac {a^{3} \left (4 i \tan \left (d x +c \right )-\frac {i \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {3 \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 \ln \left (1+\tan ^{2}\left (d x +c \right )\right )-4 i \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(62\)
default \(\frac {a^{3} \left (4 i \tan \left (d x +c \right )-\frac {i \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {3 \left (\tan ^{2}\left (d x +c \right )\right )}{2}+2 \ln \left (1+\tan ^{2}\left (d x +c \right )\right )-4 i \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(62\)
parallelrisch \(\frac {-2 i a^{3} \left (\tan ^{3}\left (d x +c \right )\right )-24 i a^{3} x d +24 i a^{3} \tan \left (d x +c \right )-9 a^{3} \left (\tan ^{2}\left (d x +c \right )\right )+12 a^{3} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{6 d}\) \(70\)
norman \(-4 i a^{3} x -\frac {3 a^{3} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {4 i a^{3} \tan \left (d x +c \right )}{d}-\frac {i a^{3} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 a^{3} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) \(76\)
risch \(\frac {8 i a^{3} c}{d}-\frac {2 a^{3} \left (24 \,{\mathrm e}^{4 i \left (d x +c \right )}+33 \,{\mathrm e}^{2 i \left (d x +c \right )}+13\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {4 a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(77\)
parts \(\frac {a^{3} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}-\frac {i a^{3} \left (\frac {\left (\tan ^{3}\left (d x +c \right )\right )}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {3 i a^{3} \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}-\frac {3 a^{3} \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}\) \(113\)

[In]

int(tan(d*x+c)*(a+I*a*tan(d*x+c))^3,x,method=_RETURNVERBOSE)

[Out]

1/d*a^3*(4*I*tan(d*x+c)-1/3*I*tan(d*x+c)^3-3/2*tan(d*x+c)^2+2*ln(1+tan(d*x+c)^2)-4*I*arctan(tan(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 134, normalized size of antiderivative = 1.58 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=-\frac {2 \, {\left (24 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 33 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 13 \, a^{3} + 6 \, {\left (a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^3,x, algorithm="fricas")

[Out]

-2/3*(24*a^3*e^(4*I*d*x + 4*I*c) + 33*a^3*e^(2*I*d*x + 2*I*c) + 13*a^3 + 6*(a^3*e^(6*I*d*x + 6*I*c) + 3*a^3*e^
(4*I*d*x + 4*I*c) + 3*a^3*e^(2*I*d*x + 2*I*c) + a^3)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(6*I*d*x + 6*I*c) + 3*
d*e^(4*I*d*x + 4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) + d)

Sympy [A] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.54 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=- \frac {4 a^{3} \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 48 a^{3} e^{4 i c} e^{4 i d x} - 66 a^{3} e^{2 i c} e^{2 i d x} - 26 a^{3}}{3 d e^{6 i c} e^{6 i d x} + 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} + 3 d} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))**3,x)

[Out]

-4*a**3*log(exp(2*I*d*x) + exp(-2*I*c))/d + (-48*a**3*exp(4*I*c)*exp(4*I*d*x) - 66*a**3*exp(2*I*c)*exp(2*I*d*x
) - 26*a**3)/(3*d*exp(6*I*c)*exp(6*I*d*x) + 9*d*exp(4*I*c)*exp(4*I*d*x) + 9*d*exp(2*I*c)*exp(2*I*d*x) + 3*d)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 69, normalized size of antiderivative = 0.81 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=-\frac {2 i \, a^{3} \tan \left (d x + c\right )^{3} + 9 \, a^{3} \tan \left (d x + c\right )^{2} + 24 i \, {\left (d x + c\right )} a^{3} - 12 \, a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 24 i \, a^{3} \tan \left (d x + c\right )}{6 \, d} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^3,x, algorithm="maxima")

[Out]

-1/6*(2*I*a^3*tan(d*x + c)^3 + 9*a^3*tan(d*x + c)^2 + 24*I*(d*x + c)*a^3 - 12*a^3*log(tan(d*x + c)^2 + 1) - 24
*I*a^3*tan(d*x + c))/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 170 vs. \(2 (73) = 146\).

Time = 0.46 (sec) , antiderivative size = 170, normalized size of antiderivative = 2.00 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=-\frac {2 \, {\left (6 \, a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 18 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 24 \, a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 33 \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + 6 \, a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + 13 \, a^{3}\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^3,x, algorithm="giac")

[Out]

-2/3*(6*a^3*e^(6*I*d*x + 6*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 18*a^3*e^(4*I*d*x + 4*I*c)*log(e^(2*I*d*x + 2*I
*c) + 1) + 18*a^3*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) + 24*a^3*e^(4*I*d*x + 4*I*c) + 33*a^3*e^(2*
I*d*x + 2*I*c) + 6*a^3*log(e^(2*I*d*x + 2*I*c) + 1) + 13*a^3)/(d*e^(6*I*d*x + 6*I*c) + 3*d*e^(4*I*d*x + 4*I*c)
 + 3*d*e^(2*I*d*x + 2*I*c) + d)

Mupad [B] (verification not implemented)

Time = 4.12 (sec) , antiderivative size = 59, normalized size of antiderivative = 0.69 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^3 \, dx=\frac {4\,a^3\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )+a^3\,\mathrm {tan}\left (c+d\,x\right )\,4{}\mathrm {i}-\frac {3\,a^3\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2}-\frac {a^3\,{\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}}{3}}{d} \]

[In]

int(tan(c + d*x)*(a + a*tan(c + d*x)*1i)^3,x)

[Out]

(4*a^3*log(tan(c + d*x) + 1i) + a^3*tan(c + d*x)*4i - (3*a^3*tan(c + d*x)^2)/2 - (a^3*tan(c + d*x)^3*1i)/3)/d